class OrderBook:

    def __init__(self, bids=[], asks=[]):

        self.bids = sorted(bids, key = lambda order: -order.price)
        self.asks = sorted(asks, key = lambda order: order.price)

    def __len__(self):
        return len(self.bids) + len(self.asks)

    def add(self, order):
        if order.type == 'buy':
            self.bids.append(order)
        elif order.type == 'sell':
            self.asks.append(order)

    def remove(self, order):
        if order.type == 'buy':
            self.bids.remove(order)
        elif order.type == 'sell':
            self.asks.remove(order)
		